package com.springboot.kafka.controller;

import com.springboot.kafka.kafka.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class ProducerController {

    @Autowired
    private Producer producer;

    @GetMapping
    public String send(@RequestParam("content") String content) {
        producer.send("topicA", "key", content);
        return "success";
    }

}
